<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<link rel="stylesheet" type="text/css" href="../css/demo.css">
<script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>
<title>日志列表</title>
</head>
<body class="easyui-layout">
	<div data-options="region:'center',title:'日志列表'">
		<table id="dg" class="easyui-datagrid"
				data-options="
					url:'../logList',
					rownumbers:true,
					fitColumns:true,
					fit:true,
					singleSelect:true,
					pagination:true,
					pagePosition:'bottom',
					pageSize:50,
					pageList:[10,20,30,40,50],
					toolbar:'#tb' ">
			<thead>
				<tr>
					<th field="logNames" width="90%">日志名称</th>
				</tr>
			</thead>
		</table>
	</div>

	<div id="tb" style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="getSelected();">详情</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteLog();">删除</a>
		</div>
	</div>
	
</body>
<%@ include file="window.jsp"%>
<script>
/* 	$(window).load(function(){
		$.post("../logList",{},function(data,status){
			var html="";
			var json = eval("("+data+")");
			if(json.length <=0){
				html="没有日志文件";
			}else{
				for(var i in json){
					html += "<a href='logList.jsp?logName="+json[i]+"'>"+json[i]+"</a>&nbsp;<a href='' onclick='deleteLog(\""+json[i]+"\")'>删除</a><br/>";
				}
			}
			$("#list").html(html);
		});
	}); */
	
	function deleteLog(){
		var row = $('#dg').datagrid('getSelected');
		if(row){
			var logName = row.logNames;
		 	if(confirm("是否删除"+logName+"？")){
				$.post("../deleteLog",{'logName':logName},function(data,status){
					if(data == "true"){
						alert("删除成功");
						location.reload();
					}else{
						alert("删除失败");
					}
				});
			}  
		}else{
			alert("false");
		} 
	}
	function getSelected(){
		var row = $('#dg').datagrid('getSelected');
		if(row){
			var logName = row.logNames;
			$('#dgg').datagrid({
				url:'../logDetail',
				queryParams: {logName:logName}
			});
			$('#formWindowList').window('open');
		}else{
			alert("false");
		} 
	}
</script>
<body>
</body>
</html>